import math


def add(a, b):
    return a + b


def subtract(a, b):
    return a - b


def multiply(a, b):
    return a * b


def divide(a, b):
    if b == 0:
        return "Error: Division by zero"
    else:
        return a / b


def sin_func(a):
    return math.sin(a)


def cos_func(a):
    return math.cos(a)


def tan_func(a):
    return math.tan(a)


def log_func(a, b):
    return math.log(a, b)


def exp_func(a, b):
    return a ** b


def ln_func(a):
    return math.log(a)


def e_exp_func(a):
    return math.exp(a)


def sqrt_func(a):
    return math.sqrt(a)


Flag = True
while Flag:
    a = float(input("请输入第一个数（a）: "))
    b = float(input("请输入第二个数（b）: "))
    operator = input("请输入运算符（+、-、*、/、sin、cos、tan、log、ln、sqrt）: ")
    if operator == '+':
        result = add(a, b)
        print("运算结果: ", result)
    elif operator == '-':
        result = subtract(a, b)
        print("运算结果: ", result)
    elif operator == '*':
        result = multiply(a, b)
        print("运算结果: ", result)
    elif operator == '/':
        result = divide(a, b)
        print("运算结果: ", result)
    elif operator == 'sin':
        result = sin_func(math.radians(a))
        print("运算结果: sin(a)=", result)
    elif operator == 'cos':
        result = cos_func(math.radians(a))
        print("运算结果: cos(a)=", result)
    elif operator == 'tan':
        result = tan_func(math.radians(a))
        print("运算结果: tan(a)=", result)
    elif operator == 'log':
        result = log_func(a, b)
        print("运算结果: log(a, b)=", result)
    elif operator == 'ln':
        result = ln_func(a)
        print("运算结果: ln(a)=", result)
    elif operator == 'sqrt':
        result = sqrt_func(a)
        print("运算结果: √a=", result)
    else:
        print("无效的运算符。请重新输入。")
    Flag = True if input("是否继续 ：y or n \n") == 'y' else False